var layerId;
var clickState = true;
$(function(){
	$("#save-button").click(function(){
		var name = $("input[name='name']").val();
		var englishName = $("input[name='englishName']").val();
		var image = $("#image").attr("data-img");
		if(name.length == 0){
			layer.msg("请输入标题");
			return false;
		}
		if(englishName.length == 0){
			layer.msg("请输入英文标题");
			return false;
		}
		if(image.length == 0){
			layer.msg("请上传封面图");
			return false;
		}
		var id=init.imageId;
		var type=init.type;
		var site=init.site;
		var imageData ={
			"id":id,
			"type":type,
			"site":site,
			"name":name,
			"englishName":englishName,
			"image":image
		}
		if(clickState){
			clickState = false;
			$.ajax({
				url:basePath+"/backImage/save.shtml",
				data:imageData,
				type:"post",
				dataType:"JSON",
				success:ajaxSuccessCloseFun
			});
		}
	});
	$("#close-button").click(function(){
		parent.closeLayer(0);
	});
	
});
